Strip a set of charactersΒΆ

strip_chars(S, chars)

Strip a set of characters from a string.
def strip_chars(S, chars):
    return "".join(c for c in str if c not in chars)

print("\nOriginal String: ")
print("The quick brown fox jumps over the lazy dog.")
print()
print("After stripping a,e,i,o,u:")
print(strip_chars("The quick brown fox jumps over the lazy dog.", "aeiou"))

Output:

Original String:
The quick brown fox jumps over the lazy dog.

After stripping a,e,i,o,u:
Th qck brwn fx jmps vr th lzy dg.